---
{% if allorderers is defined and (allorderers | length > 0 ) %}
OrdererOrgs:
{% for org in ordererorgs %}
  - Name: {{ org }}
    Domain: {{ org }}
{% set ocas = (allcas|selectattr('org','equalto',org)|list) %}
{% if ocas|length > 0 %}
    CA:
      Hostname: {{ ocas[0].name }}
      CommonName: {{ ocas[0].fullname }}
      Country: US
      Province: North Carolina
      Locality: Raleigh
      SANS:
        - {{ endpoint_address }}
{% endif %}
    Specs:
{%    for item in allorderers %}
{%      if item.org == org %}
      - Hostname: {{ item.name }}
        SANS:
          - {{ item.url }}
{%      endif %}
{%    endfor %}
{% endfor %}
{% endif %}

{% if allpeers is defined and (allpeers | length > 0) %}
PeerOrgs:
{% for org in peerorgs %}
  - Name: {{ org }}
    Domain: {{ org }}
    EnableNodeOUs: true
{% set ocas = (allcas|selectattr('org','equalto',org)|list) %}
{% if ocas|length > 0 %}
    CA:
      Hostname: {{ ocas[0].name }}
      CommonName: {{ ocas[0].fullname }}
      Country: US
      Province: North Carolina
      Locality: Raleigh
{% endif %}
    Specs:
{%    for item in allpeers %}
{%      if item.org == org %}
      - Hostname: {{ item.name }}
        CommonName: {{ item.fullname }}
        SANS:
          - {{ item.url }}
{%      endif %}
{%    endfor %}
{% endfor %}
{% endif %}
